﻿@model IEnumerable<MVC_basic.Models.App>

@{
    ViewBag.Title = "Apps";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@Styles.Render("~/Content/css/style.css")
@Styles.Render("~/Content/zend/css/reveal.css")
@Scripts.Render("~/Content/zend/js/foundation/jquery.reveal.js")
<script>
    function unistall(id, name) {
        var answer = confirm("Do you want to unistall " + name);
        //var answer = $('#myModal').reveal();
        if (answer == true) {
            $.ajax({
                url: "Home/uninstallApp",
                type: "get",
                data: { AppId: id },
                success: function (data) {
                    $("#" + id).remove();
                },
                error: function () {
                    alert("error");
                }
            });
        }
    }

</script>
@ViewBag.elapsedTime
<!-- <h1 class="subheader">Installed apps</h1> -->
<div style="width:700px">
<ul class="large-block-grid-4 small-block-grid-1">
    @foreach(var app in Model)
    {   
        <li id ="@app.id">@Html.ActionLink(app.name, "Index", app.appType, new { id = app.id }, new { @class="logo", @style="background: url("+app.logoUrl+") no-repeat top left; background-size:100px;", @oncontextmenu="javascript:unistall(" + app.id + "," + "'" + app.name + "'" + ");return false;" })
            @Html.ActionLink(app.name, "Index", app.appType)
        </li>
    }
    @foreach(var app in Model)
    {   
        <li id ="@app.id">@Html.ActionLink(app.name, "Index", app.appType, new { id = app.id }, new { @id=app.id, @class="logo", @style="background: url("+app.logoUrl+") no-repeat top left; background-size:100px;", @oncontextmenu="javascript:unistall(" + app.id + "," + "'" + app.name + "'" + ");return false;" })
            @Html.ActionLink(app.name, "Index", app.appType)
        </li>
    }
    @foreach(var app in Model)
    {   
        <li id ="@app.id">@Html.ActionLink(app.name, "Index", app.appType, new { id = app.id }, new { @id=app.id, @class="logo", @style="background: url("+app.logoUrl+") no-repeat top left; background-size:100px;", @oncontextmenu="javascript:unistall(" + app.id + "," + "'" + app.name + "'" + ");return false;" })
            @Html.ActionLink(app.name, "Index", app.appType)
        </li>
    }
</ul>
</div>
<a href="#" data-reveal-id="myModal">Click Me For A Modal</a>


<div id="myModal" class="reveal-modal">
     <h1>Modal Title</h1>
     <p>Any content could go in here.</p>
     <a class="close-reveal-modal">&#215;</a>
</div>